﻿// Original author contact info: Owen Emlen (owene_1998@yahoo.com)
// Note: other individuals may also have contributed to this code
// Project hosted on CodePlex.com as of 1/10/2009 at http://wpfimageviewer.codeplex.com
using System;
using System.Threading;
using System.Diagnostics;
using System.Drawing;
using BrainTechLLC;
using BrainTechLLC.WPF;
using BrainTechLLC.ImageOperators;
using BrainTechLLC.ThreadSafeObjects;
using System.Windows;

namespace ImageAppDataModels
{
    public static class ThumbnailLazyLoader
    {
        public static LazyLoader<FileImage> _lazyLoaderThumbnail = new LazyLoader<FileImage>(LoadThumbnailAction, false, ThreadPriority.Normal); //ThreadPriority.BelowNormal);

        public static void LoadThumbnailAction(ActionAndCallback<FileImage> fiAction, FileImage fi)
        {
            if (fi.ThumbnailCached == null)
            {
                Bitmap bm = fi.EnsureBitmapLoaded(false);
                fi.RaisePropertyChangedUIThread("Thumbnail");
            }
        }
    }
}